//
//  AccessTokenTests.swift
//  SinaWeiBo
//
//  Created by 谭淇 on 15/3/7.
//  Copyright (c) 2015年 &#35885;&#28103;. All rights reserved.
//

import UIKit
import XCTest

class AccessTokenTests: XCTestCase {

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }

    func testAccessTokenIsExpired() {
        var dict = ["access_token": "200",
        "expires_in": "1",
        "remind_in": "1",
        "uid": "1234"]
        var token = AccessToken(dict: dict)
        
        println(token)
        
        XCTAssertFalse(token.isExpired, "过期")
        
        dict = ["access_token": "200",
            "expires_in": "0",
            "remind_in": "1",
            "uid": "1234"]
        token = AccessToken(dict: dict)
        
        XCTAssertTrue(token.isExpired, "过期")
        
        dict = ["access_token": "200",
            "expires_in": "-1",
            "remind_in": "1",
            "uid": "1234"]
        token = AccessToken(dict: dict)
        
        XCTAssertTrue(token.isExpired, "过期")
    }

}
